<template>
  <div class="wfull">
    <a-form :labelCol="{ span: 6 }" :wrapperCol="{ span: 18 }">
      <a-form-item label="任务名称" required>
        <ZgInput :width="200" v-model="obj.name"></ZgInput>
      </a-form-item>
      <a-form-item label="任务编码" required>
        <ZgInput :width="200" v-model="obj.code"></ZgInput>
      </a-form-item>
      <a-form-item label="任务URL" required>
        <ZgInput v-model="obj.uri"></ZgInput>
      </a-form-item>
      <a-form-item label="Cron表达式" required>
        <ZgInput :width="200" v-model="obj.cron"></ZgInput>
      </a-form-item>
    </a-form>
  </div>
</template>
<script>
export default {
  data () {
    return {
      obj: {}
    }
  },
  mounted () {
    this.init()
  },
  methods: {
    init () {
      this.obj = {
        name: '',
        code: '',
        uri: '',
        cron: '*/5 * * * * ?'
      }
    },
    save () {
      if (this.obj.name.length === 0) {
        return this.$result.error('请输入任务名称')
      }
      if (this.obj.code.length === 0) {
        return this.$result.error('请输入任务编码')
      }
      if (this.obj.uri.length === 0) {
        return this.$result.error('请输入任务接口地址')
      }
      if (this.obj.cron.length === 0) {
        return this.$result.error('请设置任务执行时间')
      }
      return this.$result.ok(Object.assign({}, this.obj))
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
